package com.canbot.u05.activity;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.RelativeLayout;

import com.canbot.u05.MainApplication;
import com.canbot.u05.R;
import com.canbot.u05.activity.customvoice.ChooseAddTypeActivity;
import com.canbot.u05.utils.SPUtils;
import com.canbot.u05.view.ImageTextButton;
import com.canbot.u05.activity.customvoice.CustomDialogListActivity;


/**
 * 语音定制主页面
 *
 * @author qiandu
 */
public class VoiceCustomActivity extends BaseAcitivity {

        private ImageTextButton vc_acousticdialogue, vc_startthevoice,
                vc_feedbacksensors, vc_standbyvoice;

        private ImageButton vc_close;

        private Context mContext;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_voicecustom);
                mContext = this;
                mMicLayout = (RelativeLayout) findViewById(R.id.voicecustom);
                initView();

        }

        private void initView() {
                // LinearLayout vc_main = (LinearLayout) findViewById(R.id.vc_main);
                // setViewGroup(vc_main);
                vc_acousticdialogue = (ImageTextButton) findViewById(
                        R.id.vc_acousticdialogue);
                vc_acousticdialogue.setImageResource(R.drawable.vc_acousticdialogue);
                vc_acousticdialogue.setText("自定义声控对话");
                vc_acousticdialogue.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                                //判断是否定制过自定义对话
                                if(SPUtils.getBoolean(mContext,"isHaveData",false)){
                                        startotherActivity(mContext, CustomDialogListActivity.class);
                                }else {
                                        startotherActivity(mContext, ChooseAddTypeActivity.class);
                                }
                        }
                });

                vc_startthevoice = (ImageTextButton) findViewById(
                        R.id.vc_startthevoice);
                vc_startthevoice.setImageResource(R.drawable.vc_startthevoice);
                vc_startthevoice.setText("自定义开机语音");
                vc_startthevoice.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                                // writeMes(0x07);
//                                ((MainApplication) getApplication()).fromWitch = ConstUtils.ACTIVITY_START_VOICE;
                                // 2、开机语音
                                startotherActivity(mContext, StarttheVoiceActivity.class);
                        }
                });

                vc_feedbacksensors = (ImageTextButton) findViewById(
                        R.id.vc_feedbacksensors);
                vc_feedbacksensors.setImageResource(R.drawable.vc_feedbacksensors);
                vc_feedbacksensors.setText("自定义感应反馈");
                vc_feedbacksensors.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                                // writeMes((byte)0x08);
//                                ((MainApplication) getApplication()).fromWitch = ConstUtils.ACTIVITY_SENSOR;
                                // 3、感应反馈
                                startotherActivity(mContext, SensorVoiceActivity.class);
                        }
                });

                vc_standbyvoice = (ImageTextButton) findViewById(R.id.vc_standbyvoice);
                vc_standbyvoice.setImageResource(R.drawable.vc_standbyvoice);
                vc_standbyvoice.setText("自定义待机语音");
                vc_standbyvoice.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
//                                ((MainApplication) getApplication()).fromWitch = ConstUtils.ACTIVITY_STANDBY_VOICE;
                                // 4、待机语
                                startotherActivity(mContext, StandbyVoiceActivity.class);
                        }
                });
                vc_close = (ImageButton) findViewById(R.id.vc_close);
                vc_close.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                                finish();
                        }
                });
        }
}
